let createConfig
try {
  createConfig = require('uni-config-center')
} catch (e) {}
export function getConfig (file, key) {
  if (!file) {
    return false
  }

  const uniConfig = createConfig && createConfig({
    pluginId: 'uni-stat'
  })

  if (!uniConfig.hasFile(file + '.json')) {
    return false
  }

  const config = uniConfig.requireFile(file)

  return key ? config[key] : config
}
